package gjtx2;

import java.util.Scanner;

public class Double1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("请输入字符串：");
        String a = in.next();
        String c = "([\\d]+([\\D]|[\\d])+)";
        //System.out.println(a.matches(c));
        if (a.matches(c)) {
            while (true) {
                try {
                    Double b=new Double(Double.parseDouble(a));
                    System.out.println(b);
                    return;
                } catch (Exception A) {
                    a = a.substring(0, a.length() - 1);
                    continue;
                }
            }
        }

    }
}
